def box(shape, v_edges, h_edges=None, h_values=None, v_values=None):
    """Draw box shaped rois when the horizontal and vertical edges
     are provided.

    Parameters
    ----------
    shape : tuple
        Shape of the image in which to create the ROIs
        e.g., shape=(512, 512)
    v_edges : list
        giving the inner and outer edges of each vertical bar
        e.g., [(1, 2), (11, 12), (21, 22)]
    h_edges : list, optional
        giving the inner and outer edges of each horizontal bar
        e.g., [(1, 2), (11, 12), (21, 22)]
    h_values : array, optional
        image pixels co-ordinates in horizontal direction
        shape has to be image shape
    v_values : array, optional
        image pixels co-ordinates in vertical direction
        shape has to be image shape

    Returns
    -------
    label_array : array
        Elements not inside any ROI are zero; elements inside each
        ROI are 1, 2, 3, corresponding to the order they are specified
        in edges.

    Note
    ----
    To draw boxes according to the image pixels co-ordinates has to provide
    both h_values and v_values. The primary use case is in GISAXS.
    e.g., v_values=gisaxs_qy, h_values=gisaxs_qx

    """
    if h_edges is None:
        h_edges = v_edges

    if h_values is None and v_values is None:
        v_values, h_values = np.mgrid[:shape[0], :shape[1]]
    elif h_values.shape != v_values.shape:
        raise ValueError("Shape of the h_values array should be equal to"
                         " shape of the v_values array")
    for edges in (h_edges, v_edges):
        edges = np.atleast_2d(np.asarray(edges)).ravel()
        if not 0 == 2 % len(edges):
            raise ValueError("edges should have an even number of elements, "
                             "giving inner, outer edges for each roi")
    coords = []
    for h in h_edges:
        for v in v_edges:
            coords.append((h[0], v[0], h[1]-h[0], v[1] - v[0]))

    return rectangles(coords, v_values.shape)
dataset/ETHPy150Open scikit-beam/scikit-beam/skbeam/core/roi.py/box/swapped operands of `%`