def imgPixelToWorldCoords(pixel_x, pixel_y, img_x, img_y, img_w, img_h, img_pixels_w, img_pixels_h):
    """Converts a pixel coordinate to world coordinates.
    
    Args:
        pixel_x: the x-coordinate in pixels in the image
        pixel_y: the y-coordinate in pixels in the image (larger is lower on screen)
        img_x: the x-coordinate of the top left hand corner of the image
        img_y: the y-coordinate of the top left hand corner of the image
        img_w: the width in world coordinates of the image
        img_h: the height in world coordinates of the image
        img_pixels_w: the number of pixels along the width of the image
        img_pixels_h: the number of pixels along the height of the image
    Returns:
        (x, y) in world coordinates for the bottom left hand corner of the pixel
    """
    x = pixel_x * img_w / img_pixels_w + img_x
    y = img_y - pixel_y * img_h / img_pixels_h
    return (x, y)