code: function transformBox(startX, startY, endX, endY) {
  
                      var result = {};
  
                      if (startX > endX) {
                          result.beginX = endX;
                          result.endX = startX;
                      } else {
                          result.beginX = startX;
                          result.endX = endX;
                      }
                      if (startY > endY) {
                          result.beginY = endY;
                          result.endY = startY;
                      } else {
                          result.beginY = startY;
                          result.endY = endY;
                      }
                      return result;
                  }
docs: Transform box to object to:
  beginX is always be less then endX
  beginY is always be less then endY
  @param  {Number} startX
  @param  {Number} startY
  @param  {Number} endX
  @param  {Number} endY
  @return {Object} result Transformed object