Merge "Fix bug in deciding which rotation to use for an orientation."