New insights in the origin and evolution of the old, metal-rich open cluster NGC 6791