Entire villages have been destroyed by an earthquake in Afghanistan that has killed more than 800 people.