Maximum recordable resolution based on sensor size and aperture (diffraction); for blue/green/red wavelengths (green being most important).
The sensor's MP countresolution is (mostly) irrelevant unless it is less than the diffraction imposed limit. And a perfect lens doesn't matter if it resolves to a resolution greater than the sensor's capability.
Taken from this paper