The little-known story of how the Mughals inspired one of Europe’s most iconic painters