def get_corner_coordinates(gdal_ds=None, gt=None, cols=None, rows=None):
    """Returns (ULxy, LLxy, LRxy, URxy) in the same coordinate units like the given geotransform."""
    assert gdal_ds or gt and cols and rows, "GEOP.get_corner_coordinates: Missing argument! Please provide either 'gdal_ds' or 'gt', 'cols' AND 'rows'."
    gdal_ds_GT = gdal_ds.GetGeoTransform() if gdal_ds else gt
    ext = []
    xarr = [0, gdal_ds.RasterXSize if gdal_ds else cols]
    yarr = [0, gdal_ds.RasterYSize if gdal_ds else rows]
    for px in xarr:
        for py in yarr:
            x = gdal_ds_GT[0] + px * gdal_ds_GT[1] + py * gdal_ds_GT[2]
            y = gdal_ds_GT[3] + px * gdal_ds_GT[4] + py * gdal_ds_GT[5]
            ext.append([x, y])
        yarr.reverse()
    del gdal_ds_GT
    return ext
