Let's start with the plug/input to the VFD:
X > L1 (hot) Normally Red in NA
Y > L2 (hot) Normally Black in NA
G > PE (ground) Normally Green in NA
The VFD does not care if you mix up L1/L2
No neutral is used or connected in this case. The L2/N terminal designates the neutral for European power systems, in NA it is just L1, L2 so ignore the N.
On the motor side I'm a little confused, white, red, black and yellow seems odd, assuming a 3 phase motor. Are you sure that the yellow wire is not a yellow with a green stripe?. That would normally be a European ground wire color.
On the VFD U, V, and W are the output terminals and as you guessed the PE is ground. These would be connected to the 3 corresponding terminals (or wires) on the motor. Worst case if you hook up the U, V, W wires incorrectly is that the motor will turn backwards, simply exchange any two wires to make it turn correctly.
So the real question...... Is the yellow wire connected to the motor case (case ground)?
Assuming that yellow is connected to the motor case, the U, V, W would connect to the red, white, and black wires. Don't make these connections until you can confirm where the motor wires go. One of those wires should connect to the motor case, the other 3 should not. The 3 motor wires should have continuity between them, and should not connect to the motor case.