Moved declarations of offsetX and offsetY

Still wondering why offsetX and offsetY are negative. Kept it the way it was.