I have a bad feeling that you've got a timing chain/tensioner/broken chain rail problem. I have my doubts that either the crank sensor or cam sensor is faulty, as the text of the 1340 code would suggest. Here is the code description
P1340 - crankshaft/camshaft position sensor signals out of sequence.
In about 90% of cases I deal with, this means a skipped chain. I'm shocked there are no other supporting codes (P030x misfires).
Here, let me show you a perfect example of what typically happens. This one just happens to be on my own '00 Jetta GLS VR6
Look at the black chain guide rail to the lower left of this picture and see how much slack there is in the chain
Now, let me show you what it should look like
This job requires transmission removal to complete. If the car is a 5-spd manual, also a good time to replace the clutch set. If you would like a link to the absolute best writeup ever on a VR6 chain DIY, I will be happy to post the link.