FIX: [aml] properly handle rotation
Merge pull request #5943 from koying/fixamlrotation

FIX: [aml] properly handle rotation