Twisted permutation codes