def get_grid_coordinates(img_num, grid_size, w, h):
    """ given an image number in our sprite, map the coordinates to it in X,Y,W,H format"""
    y = int(img_num / grid_size)
    x = int(img_num - (y * grid_size))
    img_x = x * w
    img_y = y * h
    return "%s,%s,%s,%s" % (img_x, img_y, w, h)