def calculate_offsets(indexeds):
    """
    Return a list of tuples, with one tuple for each indexed object appearing
    in ``indexeds``. A tuple represents the offsets from the origin (0, 0, ..., 0)
    along each dimension. All objects must use the same indices, in the same
    order; otherwise, ``None`` is returned.

    For example, given: ::

        indexeds = [A[i,j,k], B[i,j+2,k+3]]

    Return: ::

        [(0, 0, 0), (0, 2, 3)]
    """
    processed = []
    reference = indexeds[0].base.function.indices
    for indexed in indexeds:
        dimensions = indexed.base.function.indices
        if dimensions != reference:
            return None
        handle = []
        for d, i in zip(dimensions, indexed.indices):
            offset = i - d
            if offset.is_Number:
                handle.append(int(offset))
            else:
                return None
        processed.append(tuple(handle))
    return tuple(reference), processed