On the Foundations of Shortcut Learning