code: function( viewerX, viewerY, pointWidth, pointHeight, current ) {
          var rect = viewerX;
          if (viewerX instanceof $.Rect) {
              //they passed a rect instead of individual components
              current = viewerY;
          } else {
              rect = new $.Rect(viewerX, viewerY, pointWidth, pointHeight);
          }
  
          var coordA = this.viewportToImageCoordinates(rect.getTopLeft(), current);
          var coordB = this._viewportToImageDelta(rect.width, rect.height, current);
  
          return new $.Rect(
              coordA.x,
              coordA.y,
              coordB.x,
              coordB.y,
              rect.degrees - this.getRotation(current)
          );
      }
docs: Translates from a rectangle which describes a portion of
  the viewport in point coordinates to image rectangle coordinates.
  This method can be called either by passing X,Y,width,height or an {@link OpenSeadragon.Rect}.
  @param {Number|OpenSeadragon.Rect} viewerX - The left coordinate or rectangle in viewport coordinate system.
  @param {Number} [viewerY] - The top coordinate in viewport coordinate system.
  @param {Number} [pointWidth] - The width in viewport coordinate system.
  @param {Number} [pointHeight] - The height in viewport coordinate system.
  @param {Boolean} [current=false] - Pass true to use the current location; false for target location.
  @return {OpenSeadragon.Rect} A rect representing the coordinates in the image.