def expand_rectangle(rect, scale):
    """
    Increase each side of the rectangle by scale.
    """
    x, y, w, h = rect
    w_new = int(w + w * scale * 2)
    h_new = int(h + h * scale * 2)
    x_new = max(0, int(x - w * scale))
    y_new = max(0, int(y - h * scale))
    return x_new, y_new, w_new, h_new
