Morse's index formula in VMO for compact manifolds with boundary