apply matrix transforms in the correct order