def crop_image(image, rect):
    """
        Crops an image using the rectangle passed as parameter

        Args:
            image: the image to crop
            rect: a rectangle in the form of a tuple that defines the area we
                want to crop (top left x, top left y, width, height)

        Returns:
            The cropped image
    """
    point1 = (rect[0], rect[1])  # Top-left point
    point2 = (rect[0] + rect[2], rect[1] + rect[3])  # Lower right point

    return image[point1[1]:point2[1], point1[0]:point2[0]]