Added CenterHorizontallyInRectangle and CenterVerticallyInRectangle functions.