Completed rotate and resize functionality