Function cardinal

Returns a point on cardinal direction, or 'center' for the middle.

cardinal({x: 10, y:10, width:100, height: 20}, 'center');