Added more functions

Separated rectangle color rotation and rendering into functions.