drawImage(
    tex,
    texWidth,
    texHeight,
    srcX,
    srcY,
    srcWidth,
    srcHeight,
    dstX,
    dstY,
    dstWidth,
    dstHeight,
    width,
    height,
  ) {
    const gl = this.gl_;

    if (dstX === undefined) {
      dstX = srcX;
    }
    if (dstY === undefined) {
      dstY = srcY;
    }
    if (srcWidth === undefined) {
      srcWidth = texWidth;
    }
    if (srcHeight === undefined) {
      srcHeight = texHeight;
    }
    if (dstWidth === undefined) {
      dstWidth = srcWidth;
    }
    if (dstHeight === undefined) {
      dstHeight = srcHeight;
    }
    if (width === undefined) {
      width = gl.canvas.width;
    }
    if (height === undefined) {
      height = gl.canvas.height;
    }

    gl.bindTexture(gl.TEXTURE_2D, tex);

    gl.useProgram(this.program_);

    gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer);
    gl.enableVertexAttribArray(this.positionLocation);
    gl.vertexAttribPointer(this.positionLocation, 2, gl.FLOAT, false, 0, 0);
    gl.bindBuffer(gl.ARRAY_BUFFER, this.texcoordBuffer);
    gl.enableVertexAttribArray(this.texcoordLocation);
    gl.vertexAttribPointer(this.texcoordLocation, 2, gl.FLOAT, false, 0, 0);

    // matrix for converting pixels to clip space
    let matrix = mat4.orthographic(0, width, 0, height, -1, 1);
    matrix = mat4.translate(matrix, dstX, dstY, 0);
    matrix = mat4.scale(matrix, dstWidth, dstHeight, 1);
    gl.uniformMatrix4fv(this.matrixLocation, false, matrix);

    let texMatrix = mat4.translation(srcX / texWidth, srcY / texHeight, 0);
    texMatrix = mat4.scale(
      texMatrix,
      srcWidth / texWidth,
      srcHeight / texHeight,
      1,
    );

    gl.uniformMatrix4fv(this.textureMatrixLocation, false, texMatrix);
    gl.uniform1i(this.textureLocation, 0);
    gl.drawArrays(gl.TRIANGLES, 0, this.positions.length / 2);
  }
2dContext drawImage call implemented in webgl.
Unlike images, textures do not have a width and height associated
with them so we'll pass in the width and height of the texture.

@param {WebGLTexture} tex Image to draw.
@param {number} texWidth Image width.
@param {number} texHeight Image height.
@param {number} srcX Top-left x-point to read src image.
@param {number} srcY Top-left y-point to read src image.
@param {number} [srcWidth] Width of source to read.
@param {number} [srcHeight] Height of source to read.
@param {number} [dstX] Top-left x-point of destination.
@param {number} [dstY] Top-left y-point of destination.
@param {number} [dstWidth] Width of written image in destination.
@param {number} [dstHeight] Height of written image in destination.
@param {number} [width] Width of canvas.
@param {number} [height] Height of canvas.