def _center(rect):
    """
    Calculate the center of a rectangle using the midpoint formula.

    :param rect: (x, y, w, h) tuple where (x, y) is the top-left corner, w is the width, and h is the height of the rectangle
    :return: (x, y) tuple where (x, y) is the center of the rectangle.
    """
    x, y, w, h = rect
    return (x + x + w) / 2, (y + y + h) / 2