Optimal convergence of a discontinuous-Galerkin-based immersed boundary method