Help with an addon for UV laying

Hi all,
I’m trying to make an add-on which will ease the creation of UV’s for trim sheet textures. My idea is to be able to select a face, then invoke the script while in the image editor, to be able to drag-snap an area where i want my UV to lie. Imagine having tiles/bricks and i want to map each face to a tile.

I think I’ve got most of the components working, but I can not get my head around how to see where my cursor is within the texture in the image editor. I can find the size and position of the editor itself, but I need the position to be relative to my texture.

Can anyone with more experience in this please help?