def crop_rect_coords(image, vertical1, horizontal1, vertical2, horizontal2):
    """Crops a rectangle out of the image through two coords.
    params:
        image: A numpy ndarray, which has 2 or 3 dimensions
        vertical1: An integer, which is the vertical coord for the top left
                   of the rectangle
        horizontal1: An integer, which is the horizontal coord for the top left
                     of the rectangle
        vertical2: An integer, which is the vertical coord for the bottom right
                   of the rectangle
        horizontal2: An integer, which is the horizontal coord for the bottom
                     right of the rectangle
    return: A numpy ndarray, which has the same number of dimensions as image
    """
    return image[vertical1:vertical2, horizontal1:horizontal2]