@classmethod
def from_points(cls, p1, p2):
    """Construct the smallest Rect that contains the points p1 and p2."""
    x1, y1 = p1
    x2, y2 = p2
    if x2 < x1:
        x1, x2 = x2, x1
    if y2 < y1:
        y1, y2 = y2, y1
    return cls(x1, x2, y1, y2)
