Rect: optimize scaling functions, remove obsolete one