Improve subs for Derivative.

Perform substitutions if derivative variables are in a different, but
equivalent order and perform substitutions for subderivatives.