Virtual distillation for quantum error mitigation