A three point quadrature rule for functions of bounded variation and applications