def pad_rectangle(rect, dx, dy):
    """
    Increase width of the rectangle by dx, and height by dy.
    """
    x, y, w, h = rect
    w_new = int(w + 2 * dx)
    h_new = int(h + 2 * dy)
    x_new = max(0, int(x - dx))
    y_new = max(0, int(y - dy))
    return x_new, y_new, w_new, h_new
