code: function computeRectIntersection(rect1, rect2) {
          var top = Math.max(rect1.top, rect2.top);
          var bottom = Math.min(rect1.bottom, rect2.bottom);
          var left = Math.max(rect1.left, rect2.left);
          var right = Math.min(rect1.right, rect2.right);
          var width = right - left;
          var height = bottom - top;
  
          return (width >= 0 && height >= 0) && {
              top: top,
              bottom: bottom,
              left: left,
              right: right,
              width: width,
              height: height
          };
      }
docs: Returns the intersection between two rect objects.
  @param {Object} rect1 The first rect.
  @param {Object} rect2 The second rect.
  @return {?Object} The intersection rect or undefined if no intersection
  is found.