code: function(viewerX, viewerY, pointWidth, pointHeight) {
          var rect = viewerX;
          if (!(rect instanceof $.Rect)) {
              //they passed individual components instead of a rectangle
              rect = new $.Rect(viewerX, viewerY, pointWidth, pointHeight);
          }
  
          if (this.viewer) {
              var count = this.viewer.world.getItemCount();
              if (count > 1) {
                  $.console.error('[Viewport.viewportToImageRectangle] is not accurate ' +
                      'with multi-image; use TiledImage.viewportToImageRectangle instead.');
              } else if (count === 1) {
                  // It is better to use TiledImage.viewportToImageCoordinates
                  // because this._contentBoundsNoRotate can not be relied on
                  // with clipping.
                  var item = this.viewer.world.getItemAt(0);
                  return item.viewportToImageRectangle(
                      viewerX, viewerY, pointWidth, pointHeight, true);
              }
          }
  
          var coordA = this.viewportToImageCoordinates(rect.x, rect.y);
          var coordB = this._viewportToImageDelta(rect.width, rect.height);
          return new $.Rect(
              coordA.x,
              coordA.y,
              coordB.x,
              coordB.y,
              rect.degrees
          );
      }
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
  OpenSeadragon.Rect
  Note: not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.
  @function
  @param {(OpenSeadragon.Rect | Number)} viewerX either a rectangle or
  the X coordinate of the top left corner of the rectangle in viewport
  coordinate system.
  @param {Number} [viewerY] the Y coordinate of the top left corner of the rectangle
  in viewport coordinate system.
  @param {Number} [pointWidth] the width of the rectangle in viewport coordinate system.
  @param {Number} [pointHeight] the height of the rectangle in viewport coordinate system.