Electron correlation in extended systems via quantum embedding