...and I am still trying to figure out how to rotate a matrix. Is there anyone online that can answer a Pascal question. I have to get some sleep or maybe feed my son. Although he is happy eating chips and ice cream I need to fix a meal :-|
You might want to pick up a book on matrix mathematics and read up on the subject.
Unless you know the theory behind it you're never going to put it into code, and once you do know the theory the code should come easily.