A simple algorithm for obtaining nearly optimal quadrature rules for NURBS-based isogeometric analysis