Beyond Imitation: Recovering Dense Rewards from Demonstrations