def coord_rel_to_abs(coords, rect):
    """Return coordinate tuple changed from relative to absolute within rect.
    In relative coordinates, top-left is (0, 0) and bottom-right is (1, 1).
    """
    x, y = coords
    x = rect.x + int(rect.w * x)
    y = rect.y + int(rect.h * y)
    return x, y