Perturbation of time scale quadratic functionals with variableendpoints