function findCenter(rect) {
    return {
        x: (rect.left + rect.right) / 2,
        y: (rect.top + rect.bottom) / 2
    };
}
finds the center :)
@typedef {Object} Rect
@property {number} top
@property {number} bottom
@property {number} left
@property {number} right
@param {Rect} rect
@return {{x: number, y: number}}