Learning Encodings by Maximizing State Distinguishability: Variational Quantum Error Correction