I think it's just a typo, but you are missing the type declaration at
Have you tried taking logs outputting the values? See if the outputs correspond to the graphic representation or if they look correct in the scenes behind.Try to implement piece by piece making sure they work at lower level.
How are you graphically rotating them?
What actually works and what doesn't?
This is all I can say right now because I'm gonna be out all day today.