code: def getCoords(x, y, w, h, pagesize):
      
      #~ print pagesize
      ax, ay = pagesize
      if x < 0:
          x = ax + x
      if y < 0:
          y = ay + y
      if w is not None and h is not None:
          if w <= 0:
              w = (ax - x + w)
          if h <= 0:
              h = (ay - y + h)
          return x, (ay - y - h), w, h
      return x, (ay - y)
docs: As a stupid programmer I like to use the upper left
      corner of the document as the 0,0 coords therefore
      we need to do some fancy calculations