Fix #93, backport rotation matrix from Next Gen