I somehow convinced myself that the rotate based on position would have no inverse, and so thought I'd have to do some sort of forwards brute force on it. I also convinced myself (through running time on my part 1) that I'd have to make my forward mapping more efficient to finish in reasonable time.
I spent an hour writing something that would automatically try to compose certain subsequent lines of the input into quicker single step permutations, before working out that that wasn't going to work.
I decided just to code up the naive brute force "run each permutation through the forward scrambler" loop that I originally thought of doing and set it away to keep my machine warm while I thought about another approach.
1.6 seconds later it returned with the answer! d'oh!