Nonlocal Calculus of Variations and Well-Posedness of Peridynamics