Merge "Fix some bugs in input rotation" into sc-dev