def box_intersect(box1, box2):
    """
    Return intersection box two (bounding) boxes.

    If the boxes don't intersect (0,0,0,0) is returned.

    :param (x,y,w,h) box1: First box with x,y specifying the left upper corner.
    :param (x,y,w,h) box2: Second bounding box.
    :return: Intersection box
    :rtype: (x,y,w,h)
    """
    x1 = max(box1[0], box2[0])
    y1 = max(box1[1], box2[1])
    x2 = min(box1[0] + box1[2], box2[0] + box2[2])
    y2 = min(box1[1] + box1[3], box2[1] + box2[3])
    w, h = x2 - x1, y2 - y1
    return (x1, y1, w, h) if w > 0 and h > 0 else (0, 0, 0, 0)
