import math


def rotate(origin, points, angle):
    """
    Rotate a list of list of 4 points, counterclockwise, by a given angle around
    a given origin. The y axis is considered going downward.
    
    Inputs : 3
        origin : tuple
            coordinates of the origin around which the rotation will be done
        points : list of list of list, as [[[px, py]]]
            points that will be rotated
        angle : int
            angle in radians of the needed rotation
    Output : 1
        points : list of list
            
    """
    oy, ox = origin
    # iterate throught all the elements of points
    for column in range(len(points)):
        for point in range(len(points[column])):
            px, py = points[column][point]
            # rotate the points according to the center and angle
            qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy)
            qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy)
            # save the new values
            points[column][point] = int(qx), int(qy)
    return points