How do I render a rectangle using primitives?

I am trying to recreate the lessons from Learn OpenGL in Defold. I am trying to simulate element buffers in Defold but I can’t seem to get it right. I am trying to recreate rectangle in this tutorial in Defold. It is coming out wrong and I keep getting an error

rectangle.buffer

[
    {
        "name": "position",
        "type": "float32",
        "count": 3,
        "data": [-0.5, -0.5, 0.0,
                0.5, -0.5, 0.0,
                0.5,  0.5, 0.0,
                -0.5,  0.5, 0.0]
    },

    {
        "name": "indices",
        "type": "uint16",
        "count": 1,
        "data": [0, 1, 2,
                2, 3, 0]
    },

    {
        "name": "color",
        "type": "float32",
        "count": 4,
        "data": [1, 0, 0, 1,
                0, 1, 0, 1,
                0, 0, 1, 1,
                1, 1, 0, 1]
    }
]

rectangle.mesh

material: "/materials/rectangle/rectangle.material"
vertices: "/rectangle/rectangle.buffer"
position_stream: "position"
normal_stream: "position"

rectangle.material

name: "rectangle"
tags: "model"
vertex_program: "/materials/rectangle/rectangle.vp"
fragment_program: "/materials/rectangle/rectangle.fp"
vertex_space: VERTEX_SPACE_LOCAL
attributes {
  name: "position"
  semantic_type: SEMANTIC_TYPE_POSITION
  vector_type: VECTOR_TYPE_VEC3
}
attributes {
  name: "color"
  semantic_type: SEMANTIC_TYPE_COLOR
  double_values {
    v: 0.0
    v: 0.0
    v: 0.0
    v: 0.0
  }
}
attributes {
  name: "indices"
  data_type: TYPE_UNSIGNED_INT
  long_values {
    v: 0
  }
  vector_type: VECTOR_TYPE_SCALAR
}

rectangle.vp

#version 330 core

in vec3 position;
in vec4 color;

out vec4 out_color;

void main()
{
	gl_Position = vec4(position, 1.0);
	out_color = color;
}

rectangle.fp

#version 330 core

out vec4 FragColor;

in vec4 out_color;

void main()
{
   FragColor = out_color;
}

What am I missing?

The error mentions that “indices” isn’t used in the shader. What if you remove it from the .material and .buffer?

Also, check this example:

Thanks for your response. I am just trying to create a rectangle using only 4 vertices. I already created a it with two triangles(6 vertices). I just want to know if there is a way to emulate using element buffers in Defold or I just have to keep using 2 triangles to create the rectangle.