carved sphere. how?

Due to its lack of ngons, how do u do the following:
create a sphere (not too dense) and do a square inward extrusion on it. Square, with sharp corners. And preserve the smoothness of the rest of the sphere’s surface.
I’m just curious how could you do that. I can’t.


There are a few way to do this they are all good for different situation, hopefully this post link may help:

thanks, man! square on the surface and retopo is what i needed!