Refactor code: merge rotate dimension and stretch dimension into motion dimension